<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>用户主页-{$read_user.nickname}</title>

  {include file='common/_require'/}
</head>

<body>

  {include file='common/_header'/}

  <div class="fly-home fly-panel" style="background-image: url();">
    <img src="{$read_user.avatar_src}" alt="{$read_user.nickname}">
    {eq name='$read_user.auth_status' value='1'}<i class="iconfont icon-renzheng" title="社区认证"></i>{/eq}
    <h1>
      {$read_user.nickname}
      {if $read_user.gender > 0 }
      {eq name='$read_user.gender' value='1'}
      <i class="iconfont icon-nan"></i>
      {else/}
      <i class="iconfont icon-nv"></i>
      {/eq}
      {else /}
      {/if}
      <i class="layui-badge fly-badge-vip">{$read_user.vip.title|default="VIP0"}</i>
      {eq name='read_user.type' value='1'}
      <span style="color:#c00;">（管理员）</span>
      {/eq}
      {eq name='read_user.status' value='1'}
      <span>（该号已被封）</span>
      {/eq}
    </h1>
    {eq name='$read_user.auth_status' value='1'}
    <p style="padding: 10px 0; color: #5FB878;">认证信息：{$read_user.auth_content}</p>
    {/eq}
    <p class="fly-home-info">
      <span style="color: #FF7200;">0 {:get_system_config('credit_title')}</span>
      <i class="iconfont icon-shijian"></i><span>{:date('Y-m-d',$read_user->getData('create_time'))} 加入</span>
      {notempty name='$read_user.city'}
      <i class="iconfont icon-chengshi"></i><span>来自{$read_user.city}</span>
      {/notempty}
    </p>


    <p class="fly-home-sign">{$read_user.sign}</p>

    {if empty($user) || $read_user.id != $user.id }
    <div class="fly-sns" data-user="">
      {if $read_user->is_friend }
      <div href="javascript:;" class="layui-btn layui-btn-primary fly-imActive getFriendWith">取消关注</div>
      {else /}
      <div href="javascript:;" class="layui-btn layui-btn-primary fly-imActive getFriendWith">加为好友</div>
      {/if}
      <a href="javascript:;" class="layui-btn layui-btn-normal send-message">发送私信</a>


      {if !empty($user) && $user.type == 1 }
      {if $read_user.status == 1 }
      <div href="javascript:;" class="layui-btn layui-btn-primary fly-imActive optionStatus">解封</div>
      {else /}
      <div href="javascript:;" class="layui-btn layui-btn-primary fly-imActive optionStatus">封号</div>
      {/if}
      {/if}

    </div>
    {/if}

  </div>

  <div class="layui-container">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md6 fly-home-jie">
        <div class="fly-panel">
          <h3 class="fly-panel-title">热门文章</h3>
          <ul class="jie-row">
            {volist name='list_post' id='post'}
            <li>
              {eq name='$post.is_good' value='1'}
              <span class="fly-jing">精</span>
              {/eq}
              <a href="{:url('Post/read',['id'=>$post.id])}" class="jie-title"> {$post.title}</a>
              <i>{:time_tran($post->create_time)}</i>
              <em class="layui-hide-xs">{$post.hits}阅/{$post.comment}答</em>
            </li>
            {/volist}
            {empty name='list_post'}
            <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><i style="font-size:14px;">没有发表任何文章</i></div>
            {/empty}
          </ul>
        </div>
      </div>


      <div class="layui-col-md6 fly-home-da">
        <div class="fly-panel">
          <h3 class="fly-panel-title">最新动态</h3>
          <ul class="home-jieda">
            {volist name='list_record' id='vo'}
            <li>
              <p>
                <span>{$vo.create_time_format}</span>
                {$vo.content_html|raw}
              </p>
              <!-- <div class="home-dacontent">
                尝试给layer.photos加上这个属性试试：
                <pre>
  full: true         
  </pre>
                文档没有提及
              </div> -->
            </li>
            {/volist}
            {empty name='$list_record'}

            <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><span>还没有任何动态</span></div>

            {/empty}
          </ul>
        </div>
      </div>
    </div>
  </div>

  {include file='common/_footer'/}

  <script>
    $('.getFriendWith').click(function () {
      $.post('{:url("User/optionFriend")}', {
        user_id: '{$read_user.id}'
      }, function (result) {
        if (result.code == 0) {
          layer.msg('操作成功')
          setTimeout(() => {
            location.reload()
          }, 1200);
        } else {
          layer.msg(result.msg)
        }
      })
    })
    $('.optionStatus').click(function () {
      $.post('{:url("User/optionStatus")}', {
        user_id: '{$read_user.id}'
      }, function (result) {
        if (result.code == 0) {
          layer.msg('操作成功')
          setTimeout(() => {
            location.reload()
          }, 1200);
        } else {
          layer.msg(result.msg)
        }
      })
    })

    $('.send-message').click(function () {
      layer.prompt({
        formType: 2,
        title: '请输入留言',

      }, function (value, index) {
        $.post('{:url("User/sendMessage")}', {
          user_id: '{$read_user.id}',
          content: value
        }, function (result) {
          if (result.code == 0) {
            layer.msg('发送成功')
            setTimeout(() => {
              location.reload()
            }, 1200);
          } else {
            layer.msg(result.msg)
          }
        })
      })
    })
  </script>
</body>

</html>